package com.gitee.cirnochat.login.model.vo.req;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Data;

/**
 * 用户登录 DTO (邮箱密码登录)
 */
@Data
@Schema(name = "用户邮箱登录信息", description = "用户邮箱登录信息")
public class UserEmailPasswordLoginRequest{
    @Schema(description = "邮箱", example = "badapple495@outlook.com")
    @Email(message = "邮箱格式不正确")
    @NotBlank(message = "邮箱不能为空")
    @Size(max = 64, message = "邮箱长度不能超过64个字符")
    private String email;

    @Schema(description = "密码", example = "P@ss1111w0rd")
    @NotBlank(message = "密码不能为空")
    @Pattern(regexp = "^(?=[A-Za-z])(?=.*[A-Z])(?=.*[a-z])(?=.*\\d).{10,20}$|" +
            "^(?=[A-Za-z])(?=.*[A-Z])(?=.*[a-z])(?=.*[^A-Za-z0-9]).{10,20}$|" +
            "^(?=[A-Za-z])(?=.*[A-Z])(?=.*\\d)(?=.*[^A-Za-z0-9]).{10,20}$|" +
            "^(?=[A-Za-z])(?=.*[a-z])(?=.*\\d)(?=.*[^A-Za-z0-9]).{10,20}$",
            message = "密码必须包含至少一个大写字母、一个小写字母、一个数字和一个特殊字符，长度在10到20位之间")
    @Size(min = 10, max = 20, message = "密码长度必须在10到20位之间")
    private String password;
}
